home *** CD-ROM | disk | FTP | other *** search
/ The Mac 13 / the-mac-13.iso / Shareware City / Demos / TextPak Demo / Extras / Shape.k < prev    next >
Encoding:
Text File  |  1995-06-09  |  1.7 KB  |  68 lines  |  [TEXT/MPS ]

  1. --
  2. -- File: SHAPE.k
  3. -- FrameWork Extension
  4. -- (c) The Carl Group, Inc., 1993
  5. --
  6. -- Major additions and alterations by Dan Crow, 1994, 1995
  7. --
  8. --     © 1994, 1995 Art of Memory Ltd.
  9. --     All Rights Reserved
  10. --
  11. -- This file is supplied as part of the TextPak demonstration. You are only
  12. -- entitled to use this software to understand how the demonstration works.
  13. -- You may not duplicate, modify, reproduce or distribute this software in
  14. -- any form. If you wish to purchase a licence to use this software, please
  15. -- contact Art of Memory Ltd.
  16. --
  17.  
  18. class SHAPE is MEDIADELEGATOR;        -- General Class for Shapes
  19.  
  20. has
  21.     PenColour;            -- Color of shape outline
  22.     PenSize;            -- Size in pixels of shape outline
  23.     myShape;            -- Circle or Rectangle
  24.     FillColour;            -- Colour of inside of rectangle
  25.     
  26.     Draw(theX, theY, theWidth, theHeight)
  27.         self.PenColour is? VECTOR;
  28.         self.PenSize is? INTEGER;
  29.     
  30.     do
  31.         if self.SetupOff(theX, theY, theWidth, theHeight) then
  32.             if self.myShape=RECTANGLE then
  33.                 self.DrawRectangle();
  34.             else if self.myShape=CIRCLE then
  35.                 self.DrawCircle();
  36.             end;
  37.             self.CleanupOff();
  38.         end;
  39.     end;
  40.     
  41.         
  42.     DrawRectangle()
  43.         external "DrawRectangle";
  44.     
  45.         
  46.     DrawCircle()
  47.         external "DrawCircle";
  48.  
  49. end;
  50.  
  51.  -- R,G,B values for some standard colors
  52. object WHITE        is {$FFFF, $FFFF, $FFFF};
  53. object RED            is {$FFFF,     0,     0}; 
  54. object GREEN        is {    0, $FFFF,     0}; 
  55. object BLUE            is {    0,     0, $FFFF}; 
  56. object GREEN_BLUE    is {    0, $8000, $9000};
  57. object YELLOW        is {$FFFF, $FFFF,     0};
  58. object REED_YELLOW    is {255, 235, 0};
  59. object CYAN            is {    0, $FFFF, $FFFF}; 
  60. object MAGENTA        is {$FFFF,     0, $FFFF}; 
  61. object BROWN        is {$8000, $4000,     0}; 
  62. object BLACK        is {    0,     0,     0};
  63.  
  64. object RECTANGLE        is 1;
  65. object CIRCLE            is 2;
  66.  
  67.  
  68.